package com.key.controller.admin;

import com.key.common.R;
import com.key.entity.Approval;
import com.key.entity.Assets;
import com.key.entity.AssetsAllocation;
import com.key.entity.StocktakingForm;
import com.key.service.AdminService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.spring.web.json.Json;

import java.sql.Timestamp;

/**
 * @Author: li
 * @CreateTime: 2023-02-17  19:24
 */

@Controller
@RequestMapping("/backstage")
@Api(value = "管理端首页",tags = "管理端首页数据接口")
 //管理端首页的相关功能
public class AdminController {

    @Autowired
    AdminService adminService;

    //查询管理员待审批任务数量
    @RequestMapping(value = "/allApprovalNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询待审批任务接口",notes = "查询管理员待审批任务数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R allApprovalNumber(){

        R r = adminService.showAllApprovalNumber();

        return r;
    }

    /**
     * 查询管理员待签字任务数量
     * @return
     */
    @RequestMapping(value = "/AllSignNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询待签字任务接口",notes = "查询管理员待签字任务数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R AllSignNumber(){

        R r = adminService.showAllSignNumber();
        return r;
    }
    /**
     * 查询当月维保到期资产数
     * @param expirationTime
     * @return
     */
    @RequestMapping(value = "/maintenanceTimeExpireNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询当月维保到期资产数接口",notes = "查询当月维保到期资产数",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiImplicitParam(name = "expirationTime",value = "当前时间",paramType = "query",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R maintenanceTimeExpireNumber(@RequestParam(name = "expirationTime") String expirationTime){
        System.out.println(expirationTime);
        R r = adminService.showMaintenanceTimeExpireNumber(expirationTime);
        return r;
    }

    /**
     * 查询所有报修资产数
     * @return
     */
    @RequestMapping(value = "/AllApplicationAssetsNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询报修资产数接口",notes = "查询所有报修资产数",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R AllApplicationAssetsNumber(){

        R r = adminService.showAllApplicationAssetsNumber();
        return r;
    }

    /**
     * 查询所有待确认调拨单数量
     * @return
     */
    @RequestMapping(value = "/allocationAssetsNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询待确认调拨单接口",notes = "查询所有待确认调拨单数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R allocationAssetsNumber(){

        R r = adminService.showAllocationAssetsNumber();

        return r;
    }

    /**
     * 查询所有待盘点任务数量
     * @return
     */
    @RequestMapping(value = "/AllInventoryNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询待盘点任务接口",notes = "查询所有待盘点任务数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R AllInventoryNumber(){

        R r = adminService.showAllSignAssetsState();


        return r;
    }


    /**
     * 查询所有资产状态及其数量
     * @return
     */
    @RequestMapping(value = "/AllAssetsStateNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询资产接口",notes = "查询所有资产状态及其数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R AllAssetsStateNumber(){

        R r = adminService.showAllStateNumber();

        return r;
    }


    /**
     * 查询所有资产的使用公司及其数量
     * @return
     */
    @RequestMapping(value = "/AllAssetsCompanyNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询资产接口",notes = "查询所有资产的使用公司及其数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R AllAssetsCompanyNumber(){

        R r = adminService.showAllAssetsCompanyNumber();

        return r;
    }


    /**
     * 查询所有资产的使用部门及其数量
     * @return
     */
    @RequestMapping(value = "/AllAssetsDeptNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询资产接口",notes = "查询所有资产的使用部门及其数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R AllAssetsDeptNumber(){

        R r = adminService.showAllAssetsDeptNumber();

        return r;
    }


    /**
     * 查询所有资产的种类及其数量
     * @return
     */
    @RequestMapping(value = "/AllAssetsTypeNumber",method = RequestMethod.GET)
    @ApiOperation(value = "查询资产接口",notes = "查询所有资产的种类及其数量",httpMethod = "get",response = Json.class)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R AllAssetsTypeNumber(){

        R r = adminService.showAllAssetsTypeNumber();
        return r;
    }

//    /**
//     * 根据日期显示资产使用情况
//     * @return
//     */
//    @RequestMapping(value = "/maintenanceTimeNumber",method = RequestMethod.GET)
//    @ApiOperation(value = "查询资产接口",notes = "根据日期显示资产使用情况",httpMethod = "get",response = Json.class)
//    @ResponseBody
//    @ApiResponses({
//            @ApiResponse(code=200,message="请求成功"),
//            @ApiResponse(code=404,message="找不到页面"),
//            @ApiResponse(code=500,message="后台服务错误")
//    })
//    public R maintenanceTimeNumber(){
//
//        R r = new R();
//        Assets assets = new Assets();
//        r.setData(assets);
//
//        return r;
//    }









}
